package com.per.shardingbeetlsqldemo.config;

import org.springframework.context.annotation.Configuration;

/**
 * @author: Cheng
 * @date: 2019/12/10 9:55
 */
@Configuration
public class ShardingDataConfig {

    /*@Bean(name = "shardingDataSource")
    public DataSource getShardingDataSource() throws SQLException {
        ShardingRuleConfiguration shardingRuleConfiguration = new ShardingRuleConfiguration();
        shardingRuleConfiguration.getTableRuleConfigs().add(orderTableRule());

        shardingRuleConfiguration.setDefaultTableShardingStrategyConfig(//
                new StandardShardingStrategyConfiguration("order_id", new ModuleSharingTableAlgorithm()));
        return ShardingDataSourceFactory.createDataSource()
    }*/

    /*public TableRuleConfiguration orderTableRule() {
        TableRuleConfiguration orderTableRule = new TableRuleConfiguration();
        orderTableRule.setLogicTable("order");
        orderTableRule.setActualDataNodes("order${0..1}");
        orderTableRule.setKeyGeneratorColumnName("order_id");
        return orderTableRule;
    }*/

}
